package me.hl.objectAndClass;

import org.junit.Test;

/**
 * Created by Planck on 2016/2/15.
 * 所有的class(类)都默认继承了父类Object
 */

public class ObjectAndClassDemo extends java.lang.Object implements Cloneable {


    public Object clone() {
        ObjectAndClassDemo o = null;
        try {
            o = (ObjectAndClassDemo) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return o;
    }

    @Test
    public void CloneTest() {
        ObjectAndClassDemo a = new ObjectAndClassDemo();
        ObjectAndClassDemo b = (ObjectAndClassDemo) a.clone();
        System.out.println(a);
        System.out.println(b);
    }


}
